package com.topvision.camerasdk.album.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * 显示图片模块适配器
 * User: jack(jackgu@topvision-cv.com)
 * Date: 2016-11-22
 * Time: 16:41
 */
public class ShowPicAdapter extends PagerAdapter {
    //存放控件集合
    ArrayList<View> views;
    public ShowPicAdapter(ArrayList<View> pagerView){
        this.views = pagerView;
    }

    @Override
    public int getCount() {
        return views.size();
    }


    @Override
    public void destroyItem(ViewGroup container, int position,
                            Object object) {
        container.removeView(views.get(position));
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(views.get(position));
        return views.get(position);
    }
}  